import 'package:flutter/material.dart';

class NoDataWidget extends StatelessWidget {
  final String description;
  final String imageName;
  final bool showImage;

  const NoDataWidget({
    Key key,
    this.description,
    this.imageName = "ico_no_data",
    this.showImage = true,
  }) : super(key: key);

  const NoDataWidget.noSearchResult() : this(description: "没有匹配的结果, 请修改关键重新搜索");

  @override
  Widget build(BuildContext context) {
    return buildNoDataSection(context);
  }

  Widget buildNoDataSection(BuildContext context) {
    return Container(
      color: Colors.white,
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: <Widget>[
          Padding(
            padding: const EdgeInsets.only(top: 10),
            child: Align(
              alignment: Alignment(0, 0),
              child: Text(
                description != null ? description : "暂无数据",
                style: TextStyle(fontSize: 14, color: Color(0xFFBFBFBF)),
              ),
            ),
          ),
        ],
      ),
    );
  }
}
